home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / notes / old.new / newVm < prev    next >
Encoding:
Text File  |  1991-09-09  |  5.5 KB  |  127 lines

  1. # New routines to support the Mach memory management interface.
  2.  
  3. # See notebook (11 June 1991) for list of operations and their desired effect
  4. # on backing files and memory objects.
  5.  
  6. # Data structures that the VM compatibility layer must keep:
  7. #
  8. # - pool of processing threads (process requests, do pageouts), plus thread to
  9. #   read requests from the port set for the memory objects
  10. #   (Set up some sort of Vm_ServerProcs mechanism.  Native Sprite
  11. #   doesn't distinguish FS cache cleaners from VM cleaners, but having a
  12. #   separate thread pool might reduce the chance of deadlock.)
  13. # - synchronization variables (for threads)
  14. # - list of memory objects that are (potentially) shared among multiple
  15. #   processes, including text (used for mmap)
  16. # - list of valid memory objects
  17. # - list of free memory objects
  18. # - per memory object:
  19. #   - memory object port (recv. rights)
  20. #   - memory object control port (send rights)
  21. #   - memory name object port [for use with vm_region in Vm_CreateVA &
  22. #     Vm_CleanupSharedFile]
  23. #   - lock
  24. #   - condition variable [e.g., for processes waiting for pageout or pagein to
  25. #     complete] 
  26. #   - status flag(s)
  27. #     - pending synch [msync call]
  28. #     - pending flush [segment is being deleted or process is being migrated]
  29. #     - dead [avoid cleaning pages for unused heap or stack]
  30. #     - cached (unused but not on free list)
  31. #     - premature init (? - okay to just change the object control port?)
  32. #     - free (can be allocated)
  33. #   - handle for swap file + file name
  34. #   - handle for file to initially page in from + file name
  35. #   - map to show which pages are backed from which file (or zero-fill)
  36. #     Note: don't assume that memory object uses the swap file in a linear
  37. #     fashion, especially for heap & stack.
  38. #   - length of the memory object (e.g., may be longer than swap file if some
  39. #     pages are backed by object file or if some pages are allocated but
  40. #     unused)
  41. #   - a.out header info (for object files) [corr. Vm_ExecInfo; to simplify
  42. #     reuse of cached text objects]
  43. #   - Sprite flags: 
  44. #     - debugged (code) segment
  45. #     - Sprite type (code, heap, stack, etc.) (compatibility) [also to
  46. #       help manage anonymous backing store]
  47. #   - segment ID (compatibility)
  48. #   x worker thread (this would be used to serialize operations on a memory
  49. #     object, rather than having a scheme where the object is locked before
  50. #     passing it to a worker process from the pool).  It seems better to rely
  51. #     on explicit locks to serialize operations, rather than implicitly
  52. #     serializing on the worker thread, because some operations on the memory
  53. #     object might be invoked from outside the VM code.
  54. #
  55. # - per task (see Vm_ProcInfo):
  56. #   - reference count [for tasks with multiple threads]
  57. #   - list of memory objects used by the task (assume at least 3 memory
  58. #     objects: text, heap, stack) [so can deallocate at exec() time and get
  59. #     the refcount right]
  60. #     (Want cooperation from emulation library so can keep track of all
  61. #     files mapped into the user address space.)
  62. #   - list of memory objects to check when a file is closed (for
  63. #     Vm_CleanupSharedFile)
  64. #   - the break (where the current heap ends) and heap start [for brk, sbrk]
  65. # other notes:
  66. # - do not vm_allocate anything in a client address space--there doesn't
  67. #   seem to be any way to get the memory object, and you might want it
  68. #   for Vm_MakeAccessible.
  69. # - blocks that are mapped by the FS cache should be pinned into memory.
  70. #
  71. # - if a user process does file I/O to a mapped file, there will probably be a
  72. #   race for the final value of the affected blocks.  This is no worse than
  73. #   with native Sprite.
  74. #
  75. # - when processing a request from the kernel, be sure to check the control
  76. #   and name ports.  If they're not the same, complain and ignore the request.
  77.  
  78. Vm_MemoryManager        # read messages on memory mgr port; call
  79.                 # Proc_NewProc if need new server thread.
  80.                 # Need to have a single reader thread that
  81.                 # will lock the appropriate memory object
  82.                 # before passing it off to the worker thread
  83.                 # (cf. MIB's mail in +mach 4/10/91).
  84. memory_object_copy        # panic--shouldn't get called
  85. memory_object_data_request    # If stack, grow memory object (down).
  86.                 # Otherwise verify that page is within memory
  87.                 # object length.  Use Vm_PageIn code to get
  88.                 # the page; call memory_object_data_provided
  89.                 # to return it to the kernel.  (Do the right
  90.                 # thing if zero-filled.)
  91. memory_object_data_unlock    # XXX shouldn't get called?
  92. memory_object_data_write    # use guts of PageOut.  Drop on the floor if
  93.                 # the memory object is dead (heap, stack, or
  94.                 # debugged text).  Grow memory object as
  95.                 # necessary.  If there is a fatal error
  96.                 # writing the page, set an error flag and
  97.                 # destroy the memory object.
  98. memory_object_init        # initialize any remaining data structures in
  99.                 # the memory object (that weren't initialized
  100.                 # when the object was created); save the given
  101.                 # ports.  Only a text segment may be cached by
  102.                 # the kernel.
  103. memory_object_lock_completed    # update list of pending lock requests, wake
  104.                 # up any threads waiting for the request to
  105.                 # finish
  106. memory_object_terminate        # use guts from Vm_SegmentDelete.
  107.                 # For code, close the object file and cache
  108.                 # the object.  For heap, close the object
  109.                 # file, delete the swap file, and cache the
  110.                 # object.  For shared file, close the backing
  111.                 # file.  For stack, delete the swap file.
  112.                 # Verify that there are actually no processes
  113.                 # using the memory object; ignore the request
  114.                 # if there are.
  115.  
  116.  
  117. Local Variables:
  118. mode: xref
  119. fill-column: 78
  120. End:
  121.